#include "misc.h"

extern uint32_t SystemCoreClock;

static __IO uint32_t uwTimingDelay;

void DelayInit(void)
{
    if (SysTick_Config(168))
        while (1);
}

void DelayMs(__IO u32 nTime)
{
    uwTimingDelay = nTime * 1000;
    while(uwTimingDelay != 0);
}

void DelayUs(__IO u32 nTime)
{
    uwTimingDelay = nTime;
    while(uwTimingDelay != 0);
}

void TimingDelay_Decrement(void)
{
  if (uwTimingDelay != 0)
  {
    uwTimingDelay--;
  }
}

